<form  method="post" id="config_form" class="form-horizontal">
    <input type="hidden" name="id" value="{$privilege.id}">
    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label"></label>
        <div class="col-md-6 col-xs-12">
            <h2>{$title}</h2>
        </div>
    </div>

    <!--<div class="form-group">-->
    <!--<label class="col-md-3 col-xs-12 control-label">客服说明</label>-->
    <!--<div class="col-md-6 col-xs-12">-->
    <textarea  name="config[customer_specification]" id="content_text" placeholder="{$title}">{$value}</textarea>
    <!--</div>-->
    <!--</div>-->

    <div>
        <div class="col-md-3 col-xs-12"></div>
        <div class="col-md-6 col-xs-12">
            <present name="errorNote">
                <div class="alert alert-danger" role="alert">
                    <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <strong>{$errorNote}</strong>
                </div>
            </present>
            <div class="form-group">
                <div class="col-md-6"><input type="reset" class="btn btn-block btn-default" value=" 清 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 空 " /></div>
                <div class="col-md-6"><button type="button" class="btn btn-block btn-info pull-right" onclick="edit()"> 提 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 交 </button></div>
            </div>
        </div>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="hint_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel">提示</h4>
                </div>
                <div class="modal-body" id="hint_content">
                </div>
                <div class="modal-footer">
                    <button type="button" id="close_btn" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <!--<button type="button" class="btn btn-primary">Save changes</button>-->
                </div>
            </div>
        </div>
    </div>
</form>
<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__/Ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__/Ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    var options = {
        zIndex: 999,
        initialFrameWidth: "95%", //初化宽度
        initialFrameHeight: 400, //初化高度
        focus: false, //初始化时，是否让编辑器获得焦点true或false
        maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign'
        , //允许的最大字符数 'fullscreen',
        pasteplain: true, autoHeightEnabled: true,
        autotypeset: {
            mergeEmptyline: true,        //合并空行
            removeClass: true,           //去掉冗余的class
            removeEmptyline: false,      //去掉空行
            textAlign: "left",           //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版
            imageBlockLine: 'center',    //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版
            pasteFilter: false,          //根据规则过滤没事粘贴进来的内容
            clearFontSize: false,        //去掉所有的内嵌字号，使用编辑器默认的字号
            clearFontFamily: false,      //去掉所有的内嵌字体，使用编辑器默认的字体
            removeEmptyNode: false,      // 去掉空节点
                                         //可以去掉的标签
            removeTagNames: {"font": 1},
            indent: false,               // 行首缩进
            indentValue: '0em'           //行首缩进的大小
        },
        toolbars: [
            ['fullscreen', 'source', '|', 'undo', 'redo',
                '|', 'bold', 'italic', 'underline', 'fontborder',
                'strikethrough', 'superscript', 'subscript',
                'removeformat', 'formatmatch', 'autotypeset',
                'blockquote', 'pasteplain', '|', 'forecolor',
                'backcolor', 'insertorderedlist',
                'insertunorderedlist', 'selectall', 'cleardoc', '|',
                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                'customstyle', 'paragraph', 'fontfamily', 'fontsize',
                '|', 'directionalityltr', 'directionalityrtl',
                'indent', '|', 'justifyleft', 'justifycenter',
                'justifyright', 'justifyjustify', '|', 'touppercase',
                'tolowercase', '|', 'link', 'unlink', 'anchor', '|',
                'imagenone', 'imageleft', 'imageright', 'imagecenter',
                '|', 'insertimage', 'emotion', 'insertvideo',
                'attachment', 'map', 'gmap', 'insertframe',
                'insertcode', 'webapp', 'pagebreak', 'template',
                'background', '|', 'horizontal', 'date', 'time',
                'spechars', 'wordimage', '|',
                'inserttable', 'deletetable',
                'insertparagraphbeforetable', 'insertrow', 'deleterow',
                'insertcol', 'deletecol', 'mergecells', 'mergeright',
                'mergedown', 'splittocells', 'splittorows',
                'splittocols', '|', 'print', 'preview', 'searchreplace']
        ]
    };
    editor = new UE.ui.Editor(options);
    editor.render("content_text");
    function edit() {
        $.ajax({
            type: "POST",
            url: "__URL__/editField",
            data:  {
                name:'{$key_name}',
                value:editor.getContent()
            },
            dataType: "json",
            success: function (data) {
                console.info(data);
                $("#hint_content").empty().append(data.message);
                $("#hint_modal").modal();
            },
            error: function (data) {
                $("#hint_content").empty().append("请求超时！");
                $("#hint_modal").modal();
            }
        });
    }
</script>